package com.company;

import java.util.Scanner;

public class Main27 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("输入一个字符串。");
        String str = in.next();
        System.out.println("输入你要查找的一个字母");
        char letter = in.next().charAt(0);

        int count = 0;
        for(int i = 0; i < str.length(); i++){
            char c = str.charAt(i);
            if(c == letter)
                count++;
        }

        System.out.println(letter + " 字母在字符串中出现了 " + count + " 次");
    }
}

